import {Check} from '../../../../mock/product/'

module.exports = {
	name: 'check',
	data() {
		return {
 			productList:[],

			receiveForm: [],
			rejectForm: {
				reason:'',
			},
			receiveDialogShow: false,
			rejectDialogShow: false,
			page:1,
			size:3,
			total:1,
			currentPage:1,
			rules: {
				blBuPr:[{
					required:true,message:'空桶价格不能为空'
				}],
				prForWaUs:[{
					required:true,message:'售价不能为空'
				}],
				producerPrice:[{
					required:true,message:'出厂价不能为空'
				}],
				prForWaDe:[{
					required:true,message:'配送提成不能为空'
				}]
			},
			rejectrules:{
				reason:[{
					required:true,message:'反馈建议不能为空'
				}]
			}
		}
	},
	methods: {
		getList(){
			this.productList = this.formProduct(Check.data); 
		},
		formProduct(productList) {
			return productList.map(product => {
				product.createTime = this.$$formatTime1(product.createTime);
				product.disposable = this.$$formDisposable(product.disposable);
				return product;
			})
		},
		handleCurrentChange(val) {
		    this.page = val;
		    this.getList();
		},
		receive(item) {
			this.receiveDialogShow = true;
			Object.assign(this.receiveForm,item);
		},
		reject() {
			this.rejectDialogShow = true;
		},
		//提交receiveForm
		submitReceiveForm(form) {
			console.log(this.receiveForm);
		},
		//重置receiveForm
		resetReceiveForm(form) {
			this.$refs[form].resetFields();
		},
		//提交rejectForm
		submitRejectForm(form) {
			console.log(this.rejectForm);
		},
		//重置rejectForm
		resetRejectForm(form) {
			this.$refs[form].resetFields();
		}
	},
	created() {
		this.getList();
	}
} 